package abc.com.abc.view;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.MediaController;
import android.widget.TextView;
import android.widget.VideoView;

import abc.com.abc.R;
import abc.com.abc.activity.VideoActivity;

public class VideoView1 {
    private TextView dringOne, dringTwo;
    private Activity mContext;
    private LayoutInflater mInflater;
    private View mCurrentView;


    public VideoView1(Activity context) {
        mContext = context;
        mInflater = LayoutInflater.from(mContext);
    }

    private void createView() {

        initView();

    }



    private void initView() {
        mCurrentView = mInflater.inflate(R.layout.main_video, null);
        dringOne = mCurrentView.findViewById(R.id.tv_liOne);
        dringTwo = mCurrentView.findViewById(R.id.tv_videoTwo);
        mCurrentView.setVisibility(View.VISIBLE);

        dringOne.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Uri uri = Uri.parse("http://m.jsyst.cn/km1/159827/");
                Intent intent = new Intent(Intent.ACTION_VIEW,uri );
                mContext.startActivity(intent);


            }
        });
        dringTwo.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                Intent intent = new Intent(mContext, VideoActivity.class);
                mContext.startActivity(intent);

            }



        });

    }


    /**
     * 获取当前z导航栏上方显示的View
     */
    public View getView(){
        if (mCurrentView == null){
            createView();
        }
        return mCurrentView;
    }

    /**
     * 显示当前导航栏上方所对应的VIEW界面
     */
    public  void showwView(){
        if (mCurrentView == null){
            createView();
        }
        mCurrentView.setVisibility(View.VISIBLE);
    }

}